<template>
    <div class="g-name">{{ goods.name }}</div>
    <div class="g-desc">{{ goods.intro }}</div>
    <p class="g-price">
      <span>{{ (goods.price/100).toFixed(2) }}</span>
      <span>{{ (goods.market_price/100).toFixed(2) }}</span>
    </p>

    <!-- 商品服务区域开始 -->
    <div class="g-service">
      <div class="service-item">
        <span class="title">促销</span>
        <span class="content">12月好物放送，App领券购买直降120元</span>
      </div>

      <div class="service-item">
        <span class="title">配送至</span>
        <span class="content">
          <span v-if="userStore.deliveryAddr.address">{{ userStore.deliveryAddr.region }}</span>
          <span v-else>请选择地址</span>
          <i class="iconfont icon-xiajiantou"></i>
        </span>
      </div>

      <div class="service-item">
        <span class="title">服务</span>
        <div class="service-content">
          <span>无忧退货</span>
          <span>快速退款</span>
          <span>免费包邮</span>
          <a href="javascript:;">了解详情</a>
        </div>
      </div>
    </div>
</template>
  

<script setup>
import { useUserStore } from '@/stores/modules/user'

// 用户存储
const userStore = useUserStore()

const props = defineProps({
    goods: {
        type: Object,
        default: () => {}
    }
})
</script>
  
<style lang="scss" scoped>
// 商品名称区域
.g-name {
  font-size: 20px;
  line-height: 26px;
}

// 商品简介区域
.g-desc {
  color: #999;
  margin-top: 10px;
}

// 商品价格区域
.g-price {
  margin-top: 10px;
  span {
    &::before {
      content: "¥";
      font-size: 14px;
    }
    &:first-child {
      color: $price-color;
      margin-right: 10px;
      font-size: 22px;
    }
    &:last-child {
      color: #999;
      text-decoration: line-through;
      font-size: 16px;
    }
  }
}

// 商品服务区域
.g-service {
  background: #f5f5f5;
  width: 500px;
  padding: 20px 10px 0 10px;
  margin-top: 10px;
  .service-item {
    padding-bottom: 20px;
    display: flex;
    align-items: center;
    .title {
      width: 70px;
      color: #999;
    }
    .content {
      cursor: pointer;
      color: #666;
      .iconfont {
        font-size: 12px;
        margin-left: 4px;
      }
    }
    .service-content {
      color: #666;
      span {
        margin-right: 10px;
        &::before {
          content: "•";
          color: $main-color;
          margin-right: 2px;
        }
      }

      a {
        color: $main-color;
      }
    }
  }
}
</style>